package com.sjtuy.galtxtreader.bookfile;

public class SimpleDialogSplitter implements DialogSplitter {
    private int maxDialogLength;
    private int likelyDialogLength;

    public SimpleDialogSplitter(int likelyDialogLength,int maxDialogLength){
        this.likelyDialogLength=likelyDialogLength;
        this.maxDialogLength=maxDialogLength;
    }

    @Override
    public String split(String paragraph) {
        StringBuffer sb = new StringBuffer();
        while (paragraph.length()>maxDialogLength){
            sb.append(paragraph.substring(0,likelyDialogLength)).append("\n");
            paragraph=paragraph.substring(likelyDialogLength);
        }
        sb.append(paragraph).append("\n");
        return sb.toString();
    }
}
